/*
 * PopupMenu.cpp
 *
 *  Created on: 2.12.2009
 *      Author: apoi
 */

#include <QMenu>
#include <QKeyEvent>
#include <QApplication>
#include "PopupMenu.h"

PopupMenu::PopupMenu(QWidget *aParent) : QMenu(aParent)
{

}

PopupMenu::~PopupMenu()
{
}

void PopupMenu::keyPressEvent(QKeyEvent *e)
{
    if (e->key() == Qt::Key_Left)
    {
        close();
        e->accept();
    }
    else
    {
        QMenu::keyPressEvent(e);
    }
    if(!e->isAccepted() && parent())
    {
        QApplication::sendEvent(parent(), e);
    }
}
